package cn.lanqiao.bigDate.mapper.sys;

import cn.lanqiao.bigDate.entity.sys.SysMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
 * @description 菜单权限表Mapper
 * @author yang
 * @date 2022-03-13
 */
@Mapper
public interface SysMenuMapper extends BaseMapper<SysMenu> {

    @Select(
    "<script>select t0.* from sys_menu t0 " +
    //add here if need left join
    "where 1=1" +
    "<when test='id!=null and id!=&apos;&apos; '> and t0.id=#{id}</when> " +
    "<when test='menuName!=null and menuName!=&apos;&apos; '> and t0.menu_name=#{menuName}</when> " +
    "<when test='parentId!=null and parentId!=&apos;&apos; '> and t0.parent_id=#{parentId}</when> " +
    "<when test='orderNum!=null and orderNum!=&apos;&apos; '> and t0.order_num=#{orderNum}</when> " +
    "<when test='url!=null and url!=&apos;&apos; '> and t0.url=#{url}</when> " +
    "<when test='menuType!=null and menuType!=&apos;&apos; '> and t0.menu_type=#{menuType}</when> " +
    "<when test='icon!=null and icon!=&apos;&apos; '> and t0.icon=#{icon}</when> " +
    "<when test='createBy!=null and createBy!=&apos;&apos; '> and t0.create_by=#{createBy}</when> " +
    "<when test='createTime!=null and createTime!=&apos;&apos; '> and t0.create_time=#{createTime}</when> " +
    "<when test='updateBy!=null and updateBy!=&apos;&apos; '> and t0.update_by=#{updateBy}</when> " +
    "<when test='updateTime!=null and updateTime!=&apos;&apos; '> and t0.update_time=#{updateTime}</when> " +
    "<when test='remark!=null and remark!=&apos;&apos; '> and t0.remark=#{remark}</when> " +
    //add here if need page limit
    //" limit ${page},${limit} " +
    " </script>")
    List<SysMenu> pageAll(SysMenu queryParamDTO,int page,int limit);

    @Select("<script>select count(1) from sys_menu t0 " +
    //add here if need left join
    "where 1=1" +
    "<when test='id!=null and id!=&apos;&apos; '> and t0.id=#{id}</when> " +
    "<when test='menuName!=null and menuName!=&apos;&apos; '> and t0.menu_name=#{menuName}</when> " +
    "<when test='parentId!=null and parentId!=&apos;&apos; '> and t0.parent_id=#{parentId}</when> " +
    "<when test='orderNum!=null and orderNum!=&apos;&apos; '> and t0.order_num=#{orderNum}</when> " +
    "<when test='url!=null and url!=&apos;&apos; '> and t0.url=#{url}</when> " +
    "<when test='menuType!=null and menuType!=&apos;&apos; '> and t0.menu_type=#{menuType}</when> " +
    "<when test='icon!=null and icon!=&apos;&apos; '> and t0.icon=#{icon}</when> " +
    "<when test='createBy!=null and createBy!=&apos;&apos; '> and t0.create_by=#{createBy}</when> " +
    "<when test='createTime!=null and createTime!=&apos;&apos; '> and t0.create_time=#{createTime}</when> " +
    "<when test='updateBy!=null and updateBy!=&apos;&apos; '> and t0.update_by=#{updateBy}</when> " +
    "<when test='updateTime!=null and updateTime!=&apos;&apos; '> and t0.update_time=#{updateTime}</when> " +
    "<when test='remark!=null and remark!=&apos;&apos; '> and t0.remark=#{remark}</when> " +
     " </script>")
    int countAll(SysMenu queryParamDTO);
    @Select("insert ")
    SysMenu saveSysMenu(SysMenu sysMenu);

}